08. Check for Understanding: Lists
Check for Understanding
Data types and data structures are tricky but important concepts to master! Let's pause and make sure you understand the distinction between them.
SOLUTION:
- Data structures are containers that can include different data types.
- A list is an example of a data structure.
- All data structures are data types.
SOLUTION:
- Mutable
- Ordered
The next two quizzes will test your understanding of indexing and slicing lists. I encourage you to try answering these questions without testing them in code first. However, if you would like to experiment with code after your first try, there is a code editor at the bottom of this page for you to do so.
QUIZ QUESTION::
Choose the correct syntax to index each of the following elements from a list, arr
.
ANSWER CHOICES:
Element |
Indexing Syntax |
---|---|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
SOLUTION:
Element |
Indexing Syntax |
---|---|
|
|
|
|
|
|
|
QUIZ QUESTION::
Choose the correct syntax to slice each of the following elements from the list: arr = ['a', 'b', 'c', 'd', 'e', 'f', 'g']
ANSWER CHOICES:
Elements |
Slicing Syntax |
---|---|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
SOLUTION:
Elements |
Slicing Syntax |
---|---|
|
|
|
|
|
Start Quiz:
arr = ['a', 'b', 'c', 'd', 'e', 'f', 'g']
print(arr[0])